import { App,createApp } from 'vue';
import MainApp from './App.vue';
import router from '@/router';
import { setupStore } from '@/store';
import { setupDirective } from '@/directive';

import '@/permission';

import * as ElementPlusIconsVue from '@element-plus/icons-vue';

// 本地SVG图标
import 'virtual:svg-icons-register';

// 国际化
import i18n from '@/lang/index';

// 样式
import 'element-plus/theme-chalk/dark/css-vars.css';
import '@/styles/index.scss';
import 'uno.css';
import 'animate.css';

import VXETable from 'vxe-table';
import 'vxe-table/lib/style.css';
import VXETablePluginElement from 'vxe-table-plugin-element';
import 'vxe-table-plugin-element/dist/style.css';

VXETable.use(VXETablePluginElement);
VXETable.config({size:"mini"})

function useTable(app: App): void {
  app.use(VXETable);
}

const app = createApp(MainApp);
// 全局注册 自定义指令(directive)
setupDirective(app);
// 全局注册 状态管理(store)
setupStore(app);

for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component);
}

app.use(router).use(useTable).use(i18n).mount('#app');
